import { lazy, Suspense } from 'react'
import { Switch, Redirect, Route } from 'react-router-dom/cjs/react-router-dom'

import Loading from '../components/Loading'

const Cinema = lazy(() => import('@/views/dashboard/cinema/Index'))
const Film = lazy(() => import('@/views/dashboard/film/Index'))
const College = lazy(() => import('@/views/dashboard/college/Index'))
const User = lazy(() => import('@/views/dashboard/user/Index'))
const ShowEcharts = lazy(() => import('@/views/dashboard/echarts/ShowEcharts'))


const Routes = () => {
    return (
        <Suspense fallback={<Loading />}>
            <Switch>
                <Route path='/dashboard/welcome' component={ShowEcharts} />
                <Route path='/dashboard/user/index' component={User} />
                <Route path='/dashboard/film/index' component={Film} />
                <Route path='/dashboard/cinema/index' component={Cinema} />
                <Route path='/dashboard/college/index' component={College} />
                <Redirect from='/dashboard' to='/dashboard/welcome' exact />
            </Switch>
        </Suspense>
    )
}

export default Routes